/*
 * HolePosition.hpp
 *
 *  Created on: 11 déc. 2011
 *      Author: Elca
 */

#ifndef HOLEPOSITION_HPP_
#define HOLEPOSITION_HPP_

#include <iostream>
using namespace std;

namespace pcm {

class HolePosition {
public:
	HolePosition() ;
	virtual ~HolePosition();

	inline short int lign() const{
		return m_lign;
	}
	inline short int col() const{
		return m_col;
	}
	inline void setLign(short int _lign){
		m_lign = _lign;
	}
	inline void setCol(short int _col){
		m_col = _col;
	}

	inline void updatePost(short int _lign, short int _col){
		m_lign = _lign;
		m_col = _col;
		m_holeNumber = convToHoleNumber(m_lign,m_col);
	}
	inline  int holeNumber() const{
		return m_holeNumber;
	}
	inline static short int convToHoleNumber(short int _lign, short int _col){
		return _lign*(_lign+1)/2+_col;
	}
	friend ostream& operator <<(ostream &os,const HolePosition &obj);
protected:
	short int m_lign;
	short int m_col;
	short int m_holeNumber;
};



} /* namespace pcm */
#endif /* POSITION_H_ */
